import java.io.*;
public class FileReaderWriter {
public static void main(String[] args) {
try{
FileOutputStream f = new FileOutputStream("d://2.txt");
OutputStreamWriter out = new OutputStreamWriter(f, "utf-8");
out.write("abcedfghijklmnopqrstuvwxyz中国");
out.close();
}catch(Exception e){
System.out.println(e.getMessage());
}
try{
FileInputStream f = new FileInputStream("d://2.txt");
InputStreamReader in = new InputStreamReader(f,"utf-8");
char[] buf = new char[1024];
int len = in.read(buf);
in.close();
System.out.println(new String(buf,0,len));
System.out.println(new String(buf,0,len).replace("\uFEFF", ""));
}catch(Exception e){
System.out.println(e.getMessage());
}
}
}